package com.blackbox.price.configuration;

/**
 * @Author: TWQ
 * @Description:
 * @Date: Created in 2020-08-08 8:54
 * @Modidied By:
 * @Version
 */
/**
 * VisionResult
 */
public class VisionResult {
    /*响应业务状态
     * 200    成功
     * 201    错误
     * 400    参数错误
     */
    private Integer status;
    // 响应消息
    private String msg;
    // 响应中的数据
    private Object data;

    public static final Integer SUCCESS = 200;
    public static final Integer ERROR = 201;
    public static final Integer RELOGIN = 203;
    public static final Integer PARAMERROR = 400;
    public static final Integer CHANGEDERROR = 401;
    public static final String USRENAMEORPWDISWRONG = "用户或密码错误";

    public static final String PARAMISNOTNULL = "参数不能为空";

    public static final String LOGININFOISNULL = "缺失登录信息";

    public static VisionResult build(Integer status, String msg, Object data) {
        return new VisionResult(status, msg, data);
    }
    public static VisionResult oK(Object data) {
        return new VisionResult(data);
    }
    public static VisionResult oK() {
        return new VisionResult(null);
    }
    public VisionResult() {
    }
    public static VisionResult build(Integer status, String msg) {
        return new VisionResult(status, msg, null);
    }
    public VisionResult(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }
    public VisionResult(Object data) {
        this.status = SUCCESS;
        this.msg = "OK";
        this.data = data;
    }
    public Boolean isOk() {
        return this.status == 200;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public Object getData() {
        return data;
    }
    public void setData(Object data) {
        this.data = data;
    }
}